//生产指标报警/详情页面
import React, { Component } from "react";
import { connect } from "dva";
import {
    List,
    WhiteSpace,
    InputItem,
    WingBlank
} from "antd-mobile";
import { StickyContainer, Sticky } from "react-sticky";
import PublicService from "../../services/PublicService";
import styles from "./EnvDetails.less";
import { getAlarmInformation } from "../../services/remove";
import moment from "moment";
import EnvDetailsTu from "./Echarts/EnvDetailsTu";
import ddonfig from '../../ddconfig';
ddonfig.setTitle('环保指标详情')
//列表套件
const Item = List.Item;
const Brief = Item.Brief;

class EnvDetails extends Component {
    state = {
        name: "",
        time: null,
        details: "",
        rank: "",
        tubiaoY:[],
        tubiaoX:[]
    };
    componentDidMount() {
        let data = {
            takeTime:PublicService.getCookie("takeTime"),
            id: PublicService.getCookie("ProdetailsId")
        };
        console.log(data);
        getAlarmInformation({ ...data }).then(data => {
            console.log(data);
            if (data.data.rc == 0) {
                this.setState({
                    name:PublicService.getCookie("cordName"),
                  
                    time:PublicService.getCookie("takeTime"),
                 
                    tubiaoY:data.data.ret.series,
                    tubiaoX:data.data.ret.xAxis
                });
            }
        });
    }

    production = () => {
        console.log(1);
    };

    render() {
        const { time, rank, name, details } = this.state;
        return (
            <div>
                <div className={styles.wrap}>
                
                    <WingBlank>
                        <div className={styles.typearea}>
                        
                            <StickyContainer
                                tabBarUnderlineStyle={{ color: "red" }}
                                tabBarBackgroundColor="red"
                            >
                              <WhiteSpace />
                                <List>
                                <WhiteSpace  />
                             
                                    <InputItem
                                        value={name}
                                        editable={false}
                                        labelNumber={10}
                                        disabled={false}
                                       
                                    >
                                        环保排放指标名称:
                                    </InputItem>
                                    <InputItem
                                        value={time}
                                        disabled={false}
                                        labelNumber={10}
                                        editable={false}
                                    >
                                        报警时间:
                                    </InputItem>
                                   
                                    {/* <InputItem
                                        value={details}
                                        disabled={false}
                                        labelNumber={10}
                                        editable={false}
                                    >
                                        报警信息描述:
                                    </InputItem> */}
                                
                                </List>
                               
                            </StickyContainer>
                        </div>
                        <WhiteSpace />
                        <div className={styles.containerBottom}>
                                     <EnvDetailsTu 
                                     tubiaoX={this.state.tubiaoX}
                                     tubiaoY={this.state.tubiaoY}
                                     />
                                </div>
                    </WingBlank>
                </div>
            </div>
        );
    }
}
function mapStateToProps(state) {
    return {};
}
export default connect()(EnvDetails);
